// Each cpp program must contain three key parts

// Part I. Include header files
#include <vector> // For C++ array
#include <algorithm> // For standard algorithm
#include <iostream> // For IO

// Part II. Open namespace
using namespace std;


// Part IV. Solution
/**
 * Question
 * 
 * Write a function that takes in a non-empty array of distinct integers
 * and an integer represeting a target sum.
 * If any two numbers in the input array sum up to the target number, the
 * function should return them in an array. Or return an empty array.
 */

// How to write a function prototype?
// 1. Return type
// 2. Function name
// 3. Parameter list
// 4. Definition

// For example
// {3, 5, -4, 11, 1, -1, 6} array.size() = 7
//  ^i
//     ^j             
// targetSum 6
// 
vector<int> twoNumberSum(vector<int> array, int targetSum) {
  for (int i = 0; i < array.size() - 1; ++i) {
    for (int j = i + 1; j < array.size(); ++j) {
      if (array[i] + array[j] == targetSum) {
        return {array[i], array[j]};
      }
    }
  }

  return {};
}


// Part III. The entry point
int main(int argc, char const *argv[])
{
  vector<int> array {3, 5, -4, 11, 1, -1, 6};
  vector<int> result = twoNumberSum(array, 6);
  
  if (result.empty()) {
    cout<<"Not exist."<<endl;
  }
  else {
    for (int n : result) {
      cout<<n<<" ";
    }

    cout<<endl;
  }
  
  return 0;
}

